package com.blog.mapper;

import com.blog.entity.Log;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LogMapper {

    @Insert("insert into log " +
            "(ip,username,created_time,operation,method,params,time,status,error) " +
            "values" +
            "(#{ip},#{username},#{createdTime},#{operation},#{method},#{params},#{time},#{status},#{error}) ")
    int insert(Log log);

    @Select("select id,ip,username,created_time,operation,method,params,time,status,error " +
            "from log" +
            "order by created_time")
    List<Log> list();
}